package com.sxz.sbs.module.sms.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.sms.mode.SmsClientBean;
import com.sxz.sbs.module.sms.view.SmsClientView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;
import java.util.List;

/**
 * 短信--客户列表类别
 */

public class SmsClientPresenter extends RxPresenter<SmsClientView>{
    /**
     * 获取短信客户列表类别
     * @param map
     */
    public void getSmsClientList (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getSmsClientNum(map)
                .compose(RxUtil.<List<SmsClientBean>>handleResult())
                .subscribeWith(new RxSubscriber<List<SmsClientBean>>(mView){
                    @Override
                    public void onNext(List<SmsClientBean> data) {
                        mView.onGetClientNumSuccess(data);
                    }
                })
        );
    }
}
